package com.lcxw.hxzb.friendcircle.project.system.service.impl;

import java.util.List;
import com.lcxw.hxzb.friendcircle.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lcxw.hxzb.friendcircle.project.system.mapper.YwpdCommentMapper;
import com.lcxw.hxzb.friendcircle.project.system.domain.YwpdComment;
import com.lcxw.hxzb.friendcircle.project.system.service.IYwpdCommentService;

/**
 * 动态评论Service业务层处理
 *
 * @author jjp
 * @date 2020-07-20
 */
@Service
public class YwpdCommentServiceImpl implements IYwpdCommentService {

    @Autowired
    private YwpdCommentMapper ywpdCommentMapper;

    /**
     * 查询动态评论
     *
     * @param commentId 动态评论ID
     * @return 动态评论
     */
    @Override
    public YwpdComment selectYwpdCommentById(Long commentId) {
        return ywpdCommentMapper.selectYwpdCommentById(commentId);
    }

    /**
     * 查询动态评论列表
     *
     * @param ywpdComment 动态评论
     * @return 动态评论
     */
    @Override
    public List<YwpdComment> selectYwpdCommentList(YwpdComment ywpdComment) {
        return ywpdCommentMapper.selectYwpdCommentList(ywpdComment);
    }

    /**
     * 新增动态评论
     *
     * @param ywpdComment 动态评论
     * @return 结果
     */
    @Override
    public int insertYwpdComment(YwpdComment ywpdComment) {
        ywpdComment.setCreateTime(DateUtils.getNowDate());
        ywpdComment.setStatus(0);
        ywpdComment.setLikes(0);

        return ywpdCommentMapper.insertYwpdComment(ywpdComment);
    }

    /**
     * 修改动态评论
     *
     * @param ywpdComment 动态评论
     * @return 结果
     */
    @Override
    public int updateYwpdComment(YwpdComment ywpdComment) {
        return ywpdCommentMapper.updateYwpdComment(ywpdComment);
    }

    /**
     * 批量删除动态评论
     *
     * @param commentIds 需要删除的动态评论ID
     * @return 结果
     */
    @Override
    public int deleteYwpdCommentByIds(Long[] commentIds) {
        return ywpdCommentMapper.deleteYwpdCommentByIds(commentIds);
    }

    /**
     * 删除动态评论信息
     *
     * @param commentId 动态评论ID
     * @return 结果
     */
    @Override
    public int deleteYwpdCommentById(Long commentId) {
        return ywpdCommentMapper.deleteYwpdCommentById(commentId);
    }

    @Override
    public List<YwpdComment> selectYwpdCommentByDynamicId(Long dynamicId) {
        return ywpdCommentMapper.selectYwpdCommentByDynamicId(dynamicId);
    }

    @Override
    public List<YwpdComment> queryByDynamic(YwpdComment ywpdComment) {
        return ywpdCommentMapper.queryByDynamic(ywpdComment);
    }

    @Override
    public int deleteYwpdCommentByStatus(YwpdComment ywpdComment) {
        return ywpdCommentMapper.deleteYwpdCommentByStatus(ywpdComment);
    }

    @Override
    public Long queryCommentsByChild(YwpdComment ywpdComment) {
        return ywpdCommentMapper.queryCommentsByChild(ywpdComment);
    }

    @Override
    public List<YwpdComment> queryParentComment(YwpdComment ywpdComment) {
        return ywpdCommentMapper.queryParentComment(ywpdComment);
    }

    @Override
    public List<YwpdComment> queryChildComments(YwpdComment ywpdComment) {
        return ywpdCommentMapper.queryChildComments(ywpdComment);
    }

    @Override
    public List<YwpdComment> queryChildComment(YwpdComment ywpdComment) {
        return ywpdCommentMapper.queryChildComment(ywpdComment);
    }

    @Override
    public int updateLikesByCommentId(YwpdComment ywpdComment) {
        return ywpdCommentMapper.updateLikesByCommentId(ywpdComment);
    }

    @Override
    public int deleteLikesByCommentId(YwpdComment ywpdComment) {
        return ywpdCommentMapper.deleteLikesByCommentId(ywpdComment);
    }

    @Override
    public int insertYwpdCommentList(List<YwpdComment> ywpdComment) {

        return ywpdCommentMapper.insertYwpdCommentList(ywpdComment);
    }

    @Override
    public List<YwpdComment> queryParentAllComment(YwpdComment ywpdComment) {
        return ywpdCommentMapper.queryParentAllComment(ywpdComment);
    }

    @Override
    public List<YwpdComment> queryChildAllComment(YwpdComment ywpdComment) {
        return ywpdCommentMapper.queryChildAllComment(ywpdComment);
    }

    @Override
    public List<YwpdComment> myInteraction(YwpdComment ywpdComment) {
        return ywpdCommentMapper.myInteraction(ywpdComment);
    }

    @Override
    public YwpdComment queryByCommentId(Long parent) {
        return ywpdCommentMapper.queryByCommentId(parent);
    }
}
